<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('【请填写功能名称】列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
           <!-- <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>关联商品：</label>
                                <input type="text" name="productIDOrder"/>
                            </li>
                            <li>
                                <label>男方数量：</label>
                                <input type="text" name="manCount"/>
                            </li>
                            <li>
                                <label>女方数量：</label>
                                <input type="text" name="grilCount"/>
                            </li>
                            <li>
                                <label>商品单价：</label>
                                <input type="text" name="priceOrder"/>
                            </li>
                            <li>
                                <label>商品总数：</label>
                                <input type="text" name="countOrder"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>-->

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="system:ordertable:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="system:ordertable:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="system:ordertable:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-danger" onclick="closeItem()">
                    <i class="fa fa-reply-all"></i> 关闭
                </a>
                <!--<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="system:ordertable:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
                <!--<div class="container" >
                    <button type="button" class="btn btn-primary btn-lg btn-block" style="height:100px" onclick="doMain()"></button>
                </div>-->
            </div>
        </div>

    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">

        function doMain() {
            var url = '/system/main';
            $.modal.openTab("首页", url);
        }
        $(function(){
            $.modal.open("添加商品", "/system/ordertable/add");
        })
        var editFlag = [[${@permission.hasPermi('system:ordertable:edit')}]];
        var removeFlag = [[${@permission.hasPermi('system:ordertable:remove')}]];
        var prefix = ctx + "system/ordertable";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "【订单商品】",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'idOrder',
                    title: 'id',
                    visible: false
                },
                {
                    field: 'pName',
                    title: '商品名称'
                },
                    {
                        field: 'price',
                        title: '商品单价'
                    },
                    {
                        field: 'manCount',
                        title: '男方数量'
                    },
                    {
                        field: 'grilCount',
                        title: '女方数量'
                    },
                {
                    field: 'count',
                    title: '商品总数'
                },
                    {
                        field: 'allMoney',
                        title: '商品总价'
                    },

                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.idOrder + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.idOrder + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });
        /** 关闭选项卡 */
        var closeItem = function(dataId){
            var topWindow = $(window.parent.document);
            if($.common.isNotEmpty(dataId)){
                window.parent.$.modal.closeLoading();
                // 根据dataId关闭指定选项卡
                $('.menuTab[data-id="' + dataId + '"]', topWindow).remove();
                // 移除相应tab对应的内容区
                $('.mainContent .RuoYi_iframe[data-id="' + dataId + '"]', topWindow).remove();
                return;
            }
            var panelUrl = window.frameElement.getAttribute('data-panel');
            $('.page-tabs-content .active i', topWindow).click();
            if($.common.isNotEmpty(panelUrl)){
                $('.menuTab[data-id="' + panelUrl + '"]', topWindow).addClass('active').siblings('.menuTab').removeClass('active');
                $('.mainContent .RuoYi_iframe', topWindow).each(function() {
                    if ($(this).data('id') == panelUrl) {
                        $(this).show().siblings('.RuoYi_iframe').hide();
                        return false;
                    }
                });
            }
        }
    </script>
</body>
</html>